/* ========================================
 *
 * Copyright YOUR COMPANY, THE YEAR
 * All Rights Reserved
 * UNPUBLISHED, LICENSED SOFTWARE.
 *
 * CONFIDENTIAL AND PROPRIETARY INFORMATION
 * WHICH IS THE PROPERTY OF your company.
 *
 * ========================================
*/
#include "soft_time.h"

#define PITCH_TIME 50
uint16_t Get_Time(uint8_t time_style , Time *time)
{
    if (time_style==TIME_CLEAN){
        time->time_msec=0;
        time->time_sec=0;
        time->time_min=0;
        time->time_hour=0;
        return 0;
   }     
    if (time_style==UnitMSec){
        time->time_msec++;
        return  time->time_msec;
    }
    if (time_style==UnitSec){       
        time->time_msec++;
        if( time->time_msec>=20) {
            time->time_sec++;
             time->time_msec=0;
        }
        return time->time_sec;
       }
    if (time_style==UnitMin){
        time->time_msec++;
        if(  time->time_msec >= 20) {
            time->time_sec++;
            time->time_msec=0;
        }
        if( time->time_sec >= 60) {
            time->time_min++;
            time->time_sec=0;              
        }                         
        return time->time_min;
    }            
    if (time_style==UnitHour){
        time->time_msec++;
        if(  time->time_msec >= 20 ) {
            time->time_sec++;
            time->time_msec=0;
        }
        if(time->time_sec >= 60) {
            time->time_min++;
            time->time_sec=0;
        }                         
        if(time->time_min >= 60) {
            time->time_hour++;
            time->time_min=0;
        }                 
        return time->time_hour;
     }  
 return 0;
}
/* [] END OF FILE */
